package cn.practice.chat.controller;

import cn.practice.chat.base.BaseController;
import cn.practice.chat.lang.Result;
import cn.practice.chat.response.chat.TransferData;
import cn.practice.chat.response.friend.FriendResponse;
import cn.practice.chat.response.user.LoginUser;
import cn.practice.chat.service.FriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName FriendController
 * @Description:
 * @Author A-TAO
 * @Date 2022/11/5
 * @Version V1.0
 **/
@RestController
public class FriendController extends BaseController {

    @Autowired
    private FriendService friendService;


    @GetMapping("/friendList")
    public Result<List<FriendResponse>> getFriendList(){
        LoginUser loginUser =  getUser();
        List<FriendResponse> friends = friendService.getFriends(loginUser);
        return Result.success(friends);
    }

    @GetMapping("/transferDataList")
    public Result<List<TransferData>> getTransferDataList(){
        LoginUser loginUser =  getUser();

        List<TransferData> transferDataList = friendService.getTransferDataList(loginUser);
        return Result.success(transferDataList);
    }

}
